package gl.pk.db;

import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
import com.jfinal.plugin.druid.DruidPlugin;
import gl.pk.config.ConfigFile;
import gl.pk.db.model._MappingKit;

import java.io.IOException;
import java.util.Properties;

public class DBUtil {
    public static DruidPlugin init() throws IOException {
        Properties p = ConfigFile.getProperty();
        DruidPlugin dp = new DruidPlugin(p.getProperty("db_url"), p.getProperty("db_user"), p.getProperty("db_password"));
        ActiveRecordPlugin arp = new ActiveRecordPlugin(dp);
        _MappingKit.mapping(arp);
        dp.start();
        arp.start();
        return  dp;
    }

}
